<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 100px;
            background: red;
            margin: 100px auto;
        }
        
        .rect {
            height: 100px;
        }
        
        .box:hover {
            background: blue;
            width: 500px;
            height: 300px;
        }
    </style>
</head>

<body>
    <!--过渡四大要素：-->
    <!--1.要控制的css属性名,默认值:all,不是必需-->
    <!--2.完成过渡需要的时间,s,ms.   1000ms=1s  必须要有-->
    <div class="box rect" style="transition-property: width, background, height;transition-duration: 2000ms;"></div>
</body>

</html>